<?php defined('_JEXEC') or die('Restricted access'); ?>

<h1 class="componentheading"><?php echo JText::_( 'Show profile:' ) . " " . $this->name ?> </h1>
<?php if( $this->_user->username == $this->profile->username ): ?>
<div class="adminbox"><a href="<?php echo JRoute::_('index.php?option=com_congregation&controller=profile&task=edit') ?>"><?php echo JText::_("Modify your profile") ?></div>
<?php endif; ?>


		<table>
		
		<?php if(!empty($this->profile->photo)) : ?>
		<tr>
			<th width="200" align="right" class="key" valign="top">
				<label for="photo">
					<?php echo JText::_( 'Photo' ); ?>:
				</label>
			</th>
			<td>
				<a href="<?php echo JURI::base(). 'media/congregation/profiles/originals/' .  $this->profile->photo->filename ?>" target="_blank"><img src='<?php echo JURI::base(). 'media/congregation/profiles/thumbnails/' .  $this->profile->photo->filename ?>' border="0"/></a>
			</td>
		</tr>
		<?php endif; ?>
		<tr>
			<th width="200" align="right" class="key">
				<label for="name">
					<?php echo JText::_( 'Name' ); ?>:
				</label>
			</th>
			<td>
				<?php echo $this->profile->abbr . " " .  $this->profile->fname  . " <b>" . $this->profile->lname . "</b>" ?>
			</td>
		</tr>
		<tr>
			<th width="200" align="right" class="key">
				<label for="ordering">
					<?php echo JText::_( 'Community' ); ?>:
				</label>
			</th>
			<td>
				<a href="<?php echo JRoute::_('index.php?option=com_congregation&controller=house&task=show&id=' . $this->profile->house->c_id ) ?>"><?php echo $this->profile->house->c_name ?></a>
			</td>
		</tr>
		
<?php

	$b_label[0] = JText::_('Birth');
	$b_label[1] = JText::_('Entrance');
	$b_label[2] = JText::_('Novitiate');
	$b_label[3] = JText::_('First Profession');
	$b_label[4] = JText::_('Final Vows');
	$b_label[5] = JText::_('Ordination');

	$b_day[0] = substr($this->profile->bdate, 8, 2);
	$b_month[0] = substr($this->profile->bdate, 5, 2);
	$b_year[0] = substr($this->profile->bdate, 0, 4);
	$b_place[0] = $this->profile->bplace;

	$b_day[1] = substr($this->profile->edate, 8, 2);
	$b_month[1] = substr($this->profile->edate, 5, 2);
	$b_year[1] = substr($this->profile->edate, 0, 4);
	$b_place[1] = $this->profile->eplace;

	$b_day[2] = substr($this->profile->ndate, 8, 2);
	$b_month[2] = substr($this->profile->ndate, 5, 2);
	$b_year[2] = substr($this->profile->ndate, 0, 4);
	$b_place[2] = $this->profile->nplace;

	$b_day[3] = substr($this->profile->vdate, 8, 2);
	$b_month[3] = substr($this->profile->vdate, 5, 2);
	$b_year[3] = substr($this->profile->vdate, 0, 4);
	$b_place[3] = $this->profile->vplace;

	$b_day[4] = substr($this->profile->fdate, 8, 2);
	$b_month[4] = substr($this->profile->fdate, 5, 2);
	$b_year[4] = substr($this->profile->fdate, 0, 4);
	$b_place[4] = $this->profile->fplace;

	$b_day[5] = substr($this->profile->odate, 8, 2);
	$b_month[5] = substr($this->profile->odate, 5, 2);
	$b_year[5] = substr($this->profile->odate, 0, 4);
	$b_place[5] = $this->profile->oplace;

?>
<? for($m=0; $m<=5; $m++): ?>
  <tr>
  <th align="right" class="key">
   <label for='b_day[]'> <?php echo $b_label[$m] ?>:</label>
  </th>
  <td valign='top'>
	<?php if($b_day[$m] > 0) echo $b_day[$m] . "/" . $b_month[$m] . "/" . $b_year[$m] ?>
 </td>
 </tr>
<tr>
  <th  align="right" class="key">
  <label for="b_place[]"><?php echo JText::_('Place of') . ' ' . $b_label[$m] ?>:</label>
  </th>
  <td valign='top'>
   <?php echo $b_place[$m] ?>
  </td>
 </tr>		
 <?php endfor; ?>
 		<tr>
			<th width="200" align="right" class="key">
				<label for="language">
					<?php echo JText::_( 'Language' ); ?>:
				</label>
			</th>
			<td>
			<?php if(isset($this->languages[ $this->profile->language ])) echo $this->languages[ $this->profile->language ] ?>
			
			</td>
		</tr>
		<tr>
			<th width="200" align="right" class="key">
				<label for="nationality">
					<?php echo JText::_( 'Nationality' ); ?>:
				</label>
			</th>
			<td>
			<?php echo $this->profile->nationality ?>
			</td>
		</tr>
		<tr>
			<th width="200" align="right" class="key">
				<label for="cell">
					<?php echo JText::_( 'Telephon' ); ?>:
				</label>
			</th>
			<td>
			<?php echo $this->profile->cell ?>
			</td>
		</tr>
		<tr>
			<th width="200" align="right" class="key">
				<label for="skype">
					<?php echo JText::_( 'Skype' ); ?>:
				</label>
			</th>
			<td>
			<?php echo $this->profile->skype ?>
			</td>
		</tr>
	</table>
<h2><?php echo JText::_('Paths'); ?></h2>

	
<table width="100%" class="list">
<thead>
	<tr>
		<th><?php echo JText::_('Date') ?></th>
		<th><?php echo JText::_('Community') ?></th>
		<th><?php echo JText::_('Event or Responsibility') ?></th>
	</tr>
</thead>
<tbody>
	<?php $i = 0 ; ?>
	<?php if(!empty($this->profile->paths)): ?>
	
	<?php foreach($this->profile->paths as $path) : ?>
	<tr>
		<td>
		<?php echo substr($path->t_date,8,2) . "/" . substr($path->t_date, 5, 2) . "/" . substr($path->t_date, 0, 4) ?>
		</td>
		<td>
		<a href="<?php echo JRoute::_('index.php?option=com_congregation&controller=house&task=show&id=' . $path->t_cid ) ?>"><?php echo $path->c_name ?></a>
		</td>
		<td>
		<?php echo $path->t_charge ?>
		</td>
	</tr>
	<?php $i++; endforeach; ?>
	<?php endif; ?>
</tbody>
</table>
	
</div>
<div class="clr"></div>

